﻿/**********************************************************************
 * @file   FITKAcousticsVTKGraphObjectLoadExcForMom.h
 * @brief  载荷力与力矩可视化对象
 * @author BaGuijun (baguijun@163.com)
 * @date   2024-12-19
 *********************************************************************/
#ifndef __FITKAcousticsVTKGraphObjectLoadExcForMom_H__
#define __FITKAcousticsVTKGraphObjectLoadExcForMom_H__

#include "FITKAcousticsVTKGraphAdaptorAPI.h"
#include "FITKAcousticsVTKGraphObject3D.h"

#include "FITK_Kernel/FITKCore/FITKAbstractGraphObject.h"
#include "FITK_Interface/FITKVTKAlgorithm/FITKGraphActor.h"

namespace Interface {
    class FITKCoordinateSystem;
}

namespace Acoustics{
    class FITKAcousticsAbstractLoad;
}

class vtkArrowSource;
class vtkGlyph3D;
class vtkTransformPolyDataFilter;
class vtkPoints;
class vtkDoubleArray;
class vtkPolyData;

namespace Exchange
{
    /**
     * @brief  载荷力与力矩可视化对象
     * @author BaGuijun (baguijun@163.com)
     * @date   2024-12-19
     */
    class FITKACOUSTICSGRAPHADAPTORAPI FITKAcousticsVTKGraphObjectLoadExcForMom : public FITKAcousticsVTKGraphObject3D
    {
        FITKGraphObjectRegist(FITKAcousticsVTKGraphObjectLoadExcForMom, FITKAcousticsVTKGraphObject3D);
        FITKCLASS(Exchange, FITKAcousticsVTKGraphObjectLoadExcForMom);
    public:
        /**
         * @brief    构造函数
         * @param[i] load                载荷对象
         * @author   BaGuijun (baguijun@163.com)
         * @date     2024-12-19
         */
        FITKAcousticsVTKGraphObjectLoadExcForMom(Acoustics::FITKAcousticsAbstractLoad* load);
        /**
         * @brief    析构函数
         * @author   BaGuijun (baguijun@163.com)
         * @date     2024-12-19
         */
        virtual ~FITKAcousticsVTKGraphObjectLoadExcForMom();
        /**
         * @brief    获取数据是否可见
         * @return   bool             是否可见
         * @author   BaGuijun (baguijun@163.com)
         * @date     2024-12-19
         */
        bool getDataVisibility() override;
        /**
         * @brief    刷新重写
         * @param[i] forceUpdate        是否强制刷新
         * @author   BaGuijun (baguijun@163.com)
         * @date     2024-12-16
         */
        virtual void update(bool forceUpdate = false) override;
        /**
         * @brief    刷新数据
         * @param[i] dataId             数据id
         * @param[i] forceUpdate        是否强制刷新
         * @author   BaGuijun (baguijun@163.com)
         * @date     2025-01-20
         */
        virtual void updateById(int dataId, bool forceUpdate = false) override;
        /**
         * @brief    设置拾取模式
         * @param[i] mode                  模式
         * @author   BaGuijun (baguijun@163.com)
         * @date     2024-12-19
         */
        virtual void setPickMode(FITKAcousticsVTKCommons::ShapePickMode mode) override;
        /**
         * @brief    高亮接口
         * @param    type: The shape type need to be highlighted[default]
         * @param    color: The given color for highlighting this time[default]
         * @author   BaGuijun (baguijun@163.com)
         * @date     2024-12-19
         */
        virtual void highlight(FITKAcousticsVTKCommons::ShapeType type = FITKAcousticsVTKCommons::ShapeTypeNone, QColor color = QColor()) override;
        /**
         * @brief    取消高亮
         * @author   BaGuijun (baguijun@163.com)
         * @date     2024-12-27
         */
        virtual void disHighlight() override;
    private:
        /**
         * @brief    初始化
         * @return   void
         * @author   BaGuijun (baguijun@163.com)
         * @date     2024-12-19
         */
        void init();

        /**
         * @brief   Unused.[override]
         * @return  Is the dataset valid
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-25
         */
        bool generateDataSet();
        /**
         * @brief    获取数据是否启用
         * @return   bool                是否启用
         * @author   BaGuijun (baguijun@163.com)
         * @date     2024-12-19
         */
        bool getDataEnabled();
        /**
         * @brief    计算方向
         * @return   bool                是否成功
         * @author   BaGuijun (baguijun@163.com)
         * @date     2024-12-24
         */
        bool calculateDirection();
        /**
         * @brief    将矢量从局部坐标系转换为世界坐标系
         * @param[i] loadCoorSys         局部坐标系
         * @param[i] intVector            原矢量
         * @param[o] outVector            转换后的矢量
         * @author   BaGuijun (baguijun@163.com)
         * @date     2024-12-24
         */
        void vectorToLoadCoorSysToWordCoorSys(Interface::FITKCoordinateSystem* loadCoorSys, double* intVector, double* outVector);
    private:
        /**
         * @brief  渲染对象
         * @author BaGuijun (baguijun@163.com)
         * @date   2024-12-19
         */
        FITKAcousticsVTKGraphActor* _graphActor = nullptr;
        /**
         * @brief  箭头几何数据
         * @author BaGuijun (baguijun@163.com)
         * @date   2024-12-19
         */
        vtkArrowSource* _picData = nullptr;
        /**
         * @brief  图元
         * @author BaGuijun (baguijun@163.com)
         * @date   2024-12-24
         */
        vtkGlyph3D* _glyph3D = nullptr;
        /**
         * @brief  箭头位置
         * @author BaGuijun (baguijun@163.com)
         * @date   2024-12-24
         */
        vtkPoints* _points = nullptr;
        /**
         * @brief  箭头数据
         * @author BaGuijun (baguijun@163.com)
         * @date   2024-12-24
         */
        vtkPolyData* _polydata = nullptr;
        /**
         * @brief  箭头方向
         * @author BaGuijun (baguijun@163.com)
         * @date   2024-12-24
         */
        vtkDoubleArray* _directions = nullptr;
    };
}

#endif
